package info.rflow.graph.model;

import info.rflow.graph.RWorkflowScene;
import info.rflow.model.RBlock;


/**
 * @author Holger Brandl
 */
public class RBlockNode {

    private RBlock rBlock;

    private DataPin outputPin;
    private DataPin inputPin;


    public RBlockNode(RBlock rBlock) {
        this.rBlock = rBlock;
    }


    public RBlock getRBlock() {
        return rBlock;
    }


    public DataPin addOutputPin(RWorkflowScene workflowScene) {
        outputPin = new DataPin("out");
        workflowScene.addPin(this, outputPin);

        return outputPin;
    }


    public DataPin addInputPin(RWorkflowScene workflowScene) {
        inputPin = new DataPin("in");
        workflowScene.addPin(this, inputPin);

        return inputPin;
    }


    public String getInstanceName() {
        return rBlock.getName();
    }


    public DataPin getOutputPin() {
        return outputPin;
    }


    public DataPin getInputPin() {
        return inputPin;
    }


    @Override
    public String toString() {
        return rBlock.toString();
    }
}
